﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.IO;

namespace FYPDemo
{
    public partial class WebForm14 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string memberName = Session["username"].ToString();
                DateTime dt = DateTime.Now;

                string year = dt.Year + "";
                string month = dt.Month + "";
                string day = dt.Day + "";
                string date = year + "-" + month + "-" + day;

                txtDateFrom.Text = date;
                txtDateTo.Text = date;

                DataTable dt1 = report.OrderReportForVendor(memberName, date, date);
                VendorOrderReport_GView.DataSource = dt1;
                VendorOrderReport_GView.DataBind();
            }
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string DateFrom = "";
            string DateTo = "";
            //suppose use session to get the memberName
            string memberName = "cs";

            if (txtDateFrom.Text != "")
            {
                DateFrom = txtDateFrom.Text + " 00:00:00.000";
                Session["DatePaidFrom"] = txtDateFrom.Text;
            }
            if (txtDateTo.Text != "")
            {
                DateTo = txtDateTo.Text + " 23:59:59.998";
                Session["DatePaidTo"] = txtDateTo.Text;
            }

            DataTable dt = report.OrderReportForVendor(memberName, DateFrom, DateTo);
            VendorOrderReport_GView.DataSource = dt;
            VendorOrderReport_GView.DataBind();
        }
    }
}